/*
 * Gestures.h
 *
 *  Created on: Jan 22, 2011
 *      Author: kmueller
 */

#ifndef GESTURES_H_
#define GESTURES_H_

#include <QWidget>

class QMouseEvent;

class CircleGesture: public QWidget {
	Q_OBJECT

public:
	CircleGesture(QWidget *parent = 0);
	~CircleGesture();

	void handle(QMouseEvent* event);

signals:
	void turnLeft();
	void turnRight();

private:
	enum Direction { Right, Up, Left, Down };
	enum CircleDirection { Clockwise, Counterclockwise };

	Direction findDirection(QMouseEvent *event);
	CircleDirection findCircle(QMouseEvent *event);
	void recognize(QMouseEvent *event);

	bool enabled;
	bool recognized;

	QPoint last;
};


class MoveGesture : public QWidget {
	Q_OBJECT

public:
	MoveGesture(QWidget *parent = 0);
	~MoveGesture();

	void handle(QMouseEvent* event);

signals:
	void moved(const QPoint offset);
	void stopped(const QPoint startPoint);

private:
	bool enabled;

	QPoint start, last;
};

#endif /* GESTURES_H_ */
